// 首页的基础布局
<template>
  <el-container class="box">
    <el-header>
      <div class="left">
        <div class="imgs">
          <img class="img" src="../assets/logo.png" alt="" />
        </div>
        <p class="wenzi">6浩集团后台管理</p>
      </div>

      <div class="right">
        <el-dropdown @command="handleCommand">
          <p class="imgbox">
            <img class="headerImg" :src="headerImg" alt="" />
          </p>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="a">个人信息</el-dropdown-item>
            <el-dropdown-item command="b">用户设置</el-dropdown-item>
            <el-dropdown-item command="c">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <p class="wenzi2">你好大哥:{{ name }}&nbsp;</p>
      </div>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <!-- 左侧导航 -->
        <Leftnav></Leftnav>
      </el-aside>
      <el-container>
        <el-main>
          <!-- 面包屑导航 -->
          <Breadcrumb></Breadcrumb>
          <!-- 二级路由的坑 -->
          <router-view></router-view>
        </el-main>
        <el-footer>Footer</el-footer>
      </el-container>
    </el-container>
  </el-container>
</template>

<script>
import Leftnav from '../views/Leftnav/Leftnav.vue'
import Breadcrumb from '../components/Breadcrumb.vue';
import headerImg from '../assets/header.png'
import { removeCookie } from '../utile/cookie';
export default {
  data () {
    return {
      name: '',
      headerImg: headerImg
    }
  },
  methods: {
    handleCommand (command) {
      //   退出登录功能 
      if (command == 'c') {
        this.$message('退出成功');
        localStorage.removeItem('role')
        removeCookie('token')
        this.$router.go(0)
      }
    }
  },

  components: {
    Leftnav,
    Breadcrumb
  },
  created () {
    this.name = localStorage.getItem('role')
  }
}
</script>

<style scoped>
.el-dropdown {
  vertical-align: top;
}
.el-dropdown + .el-dropdown {
  margin-left: 15px;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.left {
  float: left;
}
.imgbox {
  float: right;
  width: 40px;
  height: 40px;
  margin-top: 10px;
}
.wenzi2 {
  float: left;
}
.headerImg {
  float: right;
  width: 100%;
  height: 100%;
}
.right {
  float: right;
}
.imgs {
  width: 200px;
  height: 100px;
  float: left;
}
.img {
  float: left;
  width: 100%;
  height: 100%;
}
.wenzi {
  float: left;
  font-size: 30px;
}
.el-container {
  height: 100%;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
  /* 设置导航菜单的展开缩回 */
  width: auto !important;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  /* line-height: 160px; */
}
</style>